package com.cn.mtm2000.mtmgeneratorsqlutil.mtmgeneratorsqlutil.generatorutil.config;

import org.apache.commons.lang3.StringUtils;

import java.util.List;

/**
 * 表配置 每个SqlMapConfig对象对应一张表
 * 
 * @author lukj
 *
 */
public class SqlMapConfig {
	private String tableName;
	private String modelTargetPackage;
	private String xmlTargetPackage;
	private String interfaceTargetPackage;
	private Boolean needCriteria;

	private List<Property> properties;

	/**
	 * 
	 * @param tableName
	 *            表名
	 * @param modelTargetPackage
	 *            实体类包路径
	 * @param interfaceTargetPackage
	 *            接口和sqlxml的包路径
	 */
	public SqlMapConfig(String tableName, String modelTargetPackage, String interfaceTargetPackage) {
		if (StringUtils.isEmpty(tableName)) {
			throw new RuntimeException("The table name  must be not null.");
		}
		if (StringUtils.isEmpty(modelTargetPackage)) {
			throw new RuntimeException("The model package  must be not null.");
		}
		// if(StringUtils.isEmpty(xmlTargetPackage)){
		// throw new RuntimeException("The xml package  must be not null.");
		// }
		if (StringUtils.isEmpty(interfaceTargetPackage)) {
			throw new RuntimeException("The interface package must be not null.");
		}
		this.tableName = tableName;
		this.modelTargetPackage = modelTargetPackage;
		// this.xmlTargetPackage = xmlTargetPackage;
		this.interfaceTargetPackage = interfaceTargetPackage;
	}

	public List<Property> getProperties() {
		return properties;
	}

	public void setProperties(List<Property> properties) {
		this.properties = properties;
	}

	public String getTableName() {
		return tableName;
	}

	public void setTableName(String tableName) {
		this.tableName = tableName;
	}

	public String getModelTargetPackage() {
		return modelTargetPackage;
	}

	public void setModelTargetPackage(String modelTargetPackage) {
		this.modelTargetPackage = modelTargetPackage;
	}

	public String getXmlTargetPackage() {
		return xmlTargetPackage;
	}

	public void setXmlTargetPackage(String xmlTargetPackage) {
		this.xmlTargetPackage = xmlTargetPackage;
	}

	public String getInterfaceTargetPackage() {
		return interfaceTargetPackage;
	}

	public void setInterfaceTargetPackage(String interfaceTargetPackage) {
		this.interfaceTargetPackage = interfaceTargetPackage;
	}

	public Boolean getNeedCriteria() {
		return needCriteria;
	}

	public void setNeedCriteria(Boolean needCriteria) {
		this.needCriteria = needCriteria;
	}

}
